package dfbz.homework11;

public class MyRun implements Runnable {
    public MyRun() {
    }

    private Integer people=100;
    private Integer fontDoor=0;
    private Integer backDoor=0;
    @Override
    public void run() {
       while (true){
           synchronized (this){
               if(people==0){
                   break;
               }else {
                   people--;
                   System.out.println("编号为:"+(100-people)+"正在从"+Thread.currentThread().getName()+"入场！"+"拿到的双色球编号为:"+DoubleColorBallUtil.create());
                   if(Thread.currentThread().getName().equals("前门")){
                       fontDoor++;
                   }else {
                       backDoor++;
                   }
               }
           }
       }
        System.out.println("从前门进的人总共有:"+this.fontDoor);
        System.out.println("从后门进的人总共有:"+this.backDoor);
    }
}
